package designPatterns_demo.proxy_pattern.static_proxy.demo2;

public class ProxyImage implements Image {
	
	private RealImage realImage;
	private String fileName;
	
	public ProxyImage(String fileName) {
		this.fileName = fileName;
	}

	@Override
	public void display() {
		if (null == realImage) {
			realImage = new RealImage(fileName);
		}
		//在调用具体函数方法前，执行功能处理
		realImage.display();
		//在调用具体函数方法后，执行功能处理
	}

}
